import { TableColumnObject } from 'amis/lib/renderers/Table'
import CaptchaApplicationStatusEnum from '@/core/captcha/enums/CaptchaApplicationStatusEnum'

class CaptchaApplicationStatusColumnUtils {
	getSchema = (parmas?: TableColumnObject): TableColumnObject => {
		const name = parmas?.name ? parmas.name : 'status'
		const mergeSchema = Object.assign(
			{
				name: name,
				label: '状态',
				type: 'mapping',
				map: {
					[CaptchaApplicationStatusEnum.NORMAL.getCode()]: CaptchaApplicationStatusEnum.NORMAL.getDesc(),
					[CaptchaApplicationStatusEnum.LOCKED.getCode()]: CaptchaApplicationStatusEnum.LOCKED.getDesc(),
					'*': '${status}',
				},
			} as TableColumnObject,
			parmas,
		)

		const schema = mergeSchema
		return schema as TableColumnObject
	}
}

export default new CaptchaApplicationStatusColumnUtils()
